/*
 * @Date:  2025-07-03 17:06:59
 * @LastEditors: LDH 574427343@qq.com
 * @LastEditTime: 2025-07-03 17:06:59
 * @FilePath: src\api\flowMsgApi.js
 * 流程通知 相关接口
 */
import request from "@/utils/request";
import Cookies from "js-cookie";
const headers = {
  Userid: Cookies.get("userId"),
  Username: Cookies.get("userName"),
};
/**
 * 获取所有通知类型
 * @returns
 */
export function getAllNoticeTypes() {
  return request({
    url: "/informationTemplates/getAllNoticeTypes",
    method: "get",
    headers: headers,
  });
}
/**
 * 新增消息模板
 * @param {*} data
 * @returns
 */
export function saveInformationTemp(data) {
  return request({
    url: "/informationTemplates/save",
    method: "post",
    data: data,
    headers: headers,
  });
}
/**
 * 获取消息模板详情
 * @returns object
 */
export function getInformationTemplateById(id) {
  return request({
    url: `/informationTemplates/getInformationTemplateById?templateId=${id}`,
    method: "get",
    headers: headers,
  });
}
/**
 * 编辑消息模板
 * @param {*} data
 * @returns
 */
export function editInformationTemp(data) {
  return request({
    url: "/informationTemplates/updateById",
    method: "post",
    data: data,
    headers: headers,
  });
}

/**
 * 获取消息模板列表
 * @returns
 */
export function getFlowMsgTempleteList(pageDto, taskMgmtVO) {
  let data = {
    pageDto: pageDto,
    entity: taskMgmtVO,
  };
  return request({
    url: "/informationTemplates/listPage",
    method: "post",
    data: data,
    headers: headers,
  });
}
/**
 * 获取通配符
 * @returns
 */
export function getWildcardCharacter() {
  return request({
    url: "/informationTemplates/getWildcardCharacter",
    method: "get",
    headers: headers,
  });
}
/**
 * 获取事件列表接口
 * @returns
 */
export function getProcessEvents() {
  return request({
    url: "/informationTemplates/getProcessEvents",
    method: "get",
    headers: headers,
  });
}

/**
 * 根据FormCode获取通知类型
 * @returns
 */
export function getNoticeTypeByFormCode(formCode) {
  return request({
    url: `/informationTemplates/getNoticeTypeByFormCode?formCode=${formCode}`,
    method: "get",
    headers: headers,
  });
}
/**
 * 保存消息通知
 * @param {*} data
 * @returns
 */
export function saveTaskMgmt(data) {
  return request({
    url: "/taskMgmt/taskMgmt",
    method: "post",
    data: data,
    headers: headers,
  });
}
